using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_poscashMap : EntityTypeConfiguration<so_poscash>
    {
        public so_poscashMap()
        {
            // Primary Key
            this.HasKey(t => new { t.DocCurrency, t.PSID, t.Doctype, t.DocNumber, t.DocDate, t.vglbatch, t.salesman, t.docmode });

            // Properties
            this.Property(t => t.CashCustomerName)
                .HasMaxLength(35);

            this.Property(t => t.DocCurrency)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Doctype)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.DocNumber)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.docnum)
                .HasMaxLength(15);

            this.Property(t => t.Notes)
                .HasMaxLength(500);

            this.Property(t => t.vglbatch)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.salesman)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.docmode)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Ps_Reference)
                .HasMaxLength(20);

            this.Property(t => t.CostCenter)
                .HasMaxLength(50);

            this.Property(t => t.user)
                .HasMaxLength(30);

            // Table & Column Mappings
            this.ToTable("so_poscash");
            this.Property(t => t.CashCustomerName).HasColumnName("CashCustomerName");
            this.Property(t => t.DocCurrency).HasColumnName("DocCurrency");
            this.Property(t => t.PSID).HasColumnName("PSID");
            this.Property(t => t.Doctype).HasColumnName("Doctype");
            this.Property(t => t.DocPrimaryKey).HasColumnName("DocPrimaryKey");
            this.Property(t => t.DocNumber).HasColumnName("DocNumber");
            this.Property(t => t.docnum).HasColumnName("docnum");
            this.Property(t => t.DocDate).HasColumnName("DocDate");
            this.Property(t => t.doc_ref).HasColumnName("doc_ref");
            this.Property(t => t.Total).HasColumnName("Total");
            this.Property(t => t.timestmp).HasColumnName("timestmp");
            this.Property(t => t.closedout).HasColumnName("closedout");
            this.Property(t => t.Notes).HasColumnName("Notes");
            this.Property(t => t.vglbatch).HasColumnName("vglbatch");
            this.Property(t => t.salesman).HasColumnName("salesman");
            this.Property(t => t.docmode).HasColumnName("docmode");
            this.Property(t => t.Ps_Reference).HasColumnName("Ps_Reference");
            this.Property(t => t.CostCenter).HasColumnName("CostCenter");
            this.Property(t => t.user).HasColumnName("user");
        }
    }
}
